<?php
class Utils_Activity{
    public static function getActivity($nid){
        $activity = new App_Activity;
        $detail = $activity->detail($nid);

        $user = User_UserInfo::user_info($detail['uid'])->current();
        $account = User_Account::user_account_info($detail['uid'])->current();

        $activity_comments =User_TouristComments::tourist_activity_check_out('activity_id',$nid);
        $comments = array();
        foreach($activity_comments as $v){
            $tmp['comments'] =  $v['comments'];
            $tmp['created'] =  date("Y.m.d",$v['created']);
            $tmp_icon = User_UserInfo::user_info($v['uid'])->current();
            $tmp_nickname = User_Account::user_account_info($detail['uid'])->current();
            $tmp['userIcon'] = $tmp_icon['userIcon'];
            $tmp['userNickName'] = $tmp_nickname['userName'];
            $comments[] = $tmp;
        }

        $imgs = explode('|',$detail['images']);
        $detail['uname'] = $user['userFamily'].$user['userName'];
        $detail['uicon'] = $user['userIcon'];
        $detail['imgs'] = $imgs;
        $detail['ugender'] = $user['userGender'] == 'm' ? '男' : '女';
        $detail['identity'] = $account['identityActive'] == '1' ? '身份已验证' : '身份未验证';
        $detail['telActive'] = $account['telActive'] == '1' ? '电话已验证' : '电话未验证';
        $detail['identityName'] = $account['identityName'];
        $detail['identityErea'] = $account['identityErea'];
        $detail['language'] = explode(',',$user['language']);
        $detail['resideCity'] = $user['resideCity'];
        $detail['resideTime'] = $user['resideTime'];
        $detail['introduction'] = $user['introduction'];
        $detail['comments'] = $comments;

        return $detail;
    }
}